﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using AccountManagement.Entities;
using AccountManagement.Managers;

namespace ServiceApp
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        public string GetData()
        {
            return "Data from Service";
        }

        public List<User> GetUsers()
        {
            return AccountManagement.Managers.UserManager.GetADUsers();
        }

        public List<Group> GetUserMemberOf(string userName)
        {
            return GroupManager.GetMemberOf(userName, ObjectType.User);
        }

        public Employee GetEmployee(string id)
        {
            return new Employee() { Id = 1, Name = "Name" + id };
        }

        public bool SaveEmployee(Employee employee)
        {
            return true;
        }

        public int UploadFile(FileInformation fileInfo)
        {
            return fileInfo.Content.Length;
        }
        // =========== groups
        public List<Group> GetGroupMemberOf(string groupName)
        {
            return GroupManager.GetMemberOf(groupName, ObjectType.Group);
        }

        public List<Group> AllGroups()
        {
            return GroupManager.GetGroups();
        }
    }
}
